<!DOCTYPE html>
<html lang="zh-CN">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="csrf-param" content="_csrf-frontend">
        <meta name="csrf-token" content="WVZlckRHVWIwL1w8fSAjAS4jJiUbDx0JNh1VMSkCBSR0EiYaK3INNg==">
        <title>
            注册
        </title>
        <link href="/assets/27b9062e/css/bootstrap.css" rel="stylesheet">
        <link href="/static/css/site.css" rel="stylesheet">
        <link href="/static/css/login.css" rel="stylesheet">
    </head>
    
    <body>
        <div class="wrap">
            <div class="container">
                <div class="site-signup">
                    <h1>
                        注册
                    </h1>
                    <div class="row">
                        <form id="form-signup" action="/site/signup" method="post" role="form">
                            <input type="hidden" name="_csrf-frontend" value="">
                            <div class="form-group field-account required">
                                <input type="text" id="account" class="form-control" name="SignupForm[username]"
                                placeholder="手机号或者邮箱" autofocus>
                                <p class="help-block help-block-error">
                                </p>
                            </div>
                            <div class="form-group" id="sms_code">
                                <div class="col-lg-12">
                                    <div class="l-captcha" data-site-key="0a619586b48d74f0b45f48998df51754"
                                    data-callback="getResponse">
                                    </div>
                                </div>
                            </div>
                            <div class="form-group field-signupform-verifycode required">
                                <input type="text" id="signupform-verifycode" class="form-control" name="SignupForm[verifycode]"
                                placeholder="验证码">
                                <a id="getcode" class="pull-right" href="/site/signup">
                                    获取验证码
                                </a>
                                <p class="help-block help-block-error">
                                </p>
                            </div>
                            <div class="form-group field-signupform-password required">
                                <input type="password" id="signupform-password" class="form-control" name="SignupForm[password]"
                                placeholder="密码">
                                <p class="help-block help-block-error">
                                </p>
                            </div>
                            <div class="form-group">
                                <button type="submit" class="btn btn-primary" name="signup-button">
                                    Signup
                                </button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <footer class="footer">
            <div class="container">
                <p class="pull-left">
                    &copy; My Company 2017
                </p>
                <p class="pull-right">
                    技术支持
                    <a href="http://www.yiiframework.com/" rel="external">
                        Yii 框架
                    </a>
                </p>
            </div>
        </footer>
        <script src="/assets/7c5b0c0c/jquery.js">
        </script>
        <script src="/assets/e6b6ea3e/yii.js">
        </script>
        <script src="/assets/e6b6ea3e/yii.validation.js">
        </script>
        <script src="/assets/e6b6ea3e/yii.activeForm.js">
        </script>
        <script src="/static/js/messager.js">
        </script>
        <script type="text/javascript">
            jQuery(document).ready(function() {
    $('#form-signup').on('click', '#getcode', function(e) {
        var account = $('#account').val();
        var response = $('#lc-captcha-response').val();
        if (account == '' || account == 'undefined') {
            $.messager.popup('请填写账号', 'error');
            return false;
        }
        if (response == '' || response == 'undefined') {
            $.messager.popup('请先进行图形验证', 'error');
            return false;
        }

        $.post('http://passport.ihuipao.cn/site/getverify', {
            'account': account,
            'response': response,
            'type': 'register'
        }, function(request, response) {
            if (request.code == 'success') {
                $.messager.popup('校验码已发送');
                Countdown();
            } else {
                $.messager.popup(request.message, 'error');
            }
        }, 'json');
        return false;
    });
    jQuery('#form-signup').yiiActiveForm([{
        "id": "signupform-username",
        "name": "username",
        "container": ".field-account",
        "input": "#account",
        "error": ".help-block.help-block-error",
        "validate": function(attribute, value, messages, deferred, $form) {
            value = yii.validation.trim($form, attribute, []);
            yii.validation.required(value, messages, {
                "message": "请填写账号"
            });
            yii.validation.string(value, messages, {
                "message": "Username必须是一条字符串。",
                "min": 2,
                "tooShort": "Username应该包含至少2个字符。",
                "max": 255,
                "tooLong": "Username只能包含至多255个字符。",
                "skipOnEmpty": 1
            });
        }
    }, {
        "id": "signupform-verifycode",
        "name": "verifycode",
        "container": ".field-signupform-verifycode",
        "input": "#signupform-verifycode",
        "error": ".help-block.help-block-error",
        "validate": function(attribute, value, messages, deferred, $form) {
            value = yii.validation.trim($form, attribute, []);
            yii.validation.required(value, messages, {
                "message": "Verifycode不能为空。"
            });
            yii.validation.string(value, messages, {
                "message": "Verifycode必须是一条字符串。",
                "min": 5,
                "tooShort": "Verifycode应该包含至少5个字符。",
                "max": 6,
                "tooLong": "Verifycode只能包含至多6个字符。",
                "skipOnEmpty": 1
            });
        }
    }, {
        "id": "signupform-password",
        "name": "password",
        "container": ".field-signupform-password",
        "input": "#signupform-password",
        "error": ".help-block.help-block-error",
        "validate": function(attribute, value, messages, deferred, $form) {
            yii.validation.required(value, messages, {
                "message": "Password不能为空。"
            });
            yii.validation.string(value, messages, {
                "message": "Password必须是一条字符串。",
                "min": 6,
                "tooShort": "Password应该包含至少6个字符。",
                "skipOnEmpty": 1
            });
        }
    }], []);
});
        </script>
    </body>

</html>
<script src="http://r0.ihuipao.cn/v3/bootstrap/js/bootstrap.min.js">
</script>
<script src="/static/js/messager.js">
</script>
<script src="//captcha.luosimao.com/static/js/api.js">
</script>
<script>
    var Countdown = function(data) {
    LUOCAPTCHA.reset();
    var btnDom = $('#getcode');
    time = btnDom.data('time') ? btnDom.data('time') : 60;
    if (time == 60) {
        btnDom.addClass('disabled');
    }
    if (time-- > 1) {
        html = '请稍候' + time;
        btnDom.html(html).data('time', time);
        var cd1 = setTimeout("Countdown()", 1000);
    } else {
        LUOCAPTCHA.reset();
        btnDom.html('重新获取验证码码').removeClass('disabled').data('time', 0);
        clearTimeout(cd1);
    }
};
</script>
